{include file="common/mainHead"/}
<div class="admin-main fadeInUp animated">
    <blockquote class="layui-elem-quote">
        <form  class="layui-form">
            <div class="layui-form-item search-input"  style="margin:0;">
                <div class="layui-input-inline">
                    <input type="text" name="key" id="key" class="layui-input" placeholder="{:lang('pleaseEnter')}关键字！">
                </div>
                <div class="layui-form-mid layui-word-aux" style="padding:0;">
                    <button type="button" class="layui-btn" id="search">{:lang('search')}</button>
                    <a href="{:url('index')}" class="layui-btn">显示全部</a>
                </div>
            </div>
        </form>
    </blockquote>
    <fieldset class="layui-elem-field">
        <legend>拍品列表</legend>
        <div class="layui-field-box table-responsive">
            <table class="layui-table table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>名称</th>
                    <th>缩略图</th>
                    <th>开始时间</th>
                    <th>起拍价</th>
                    <th>加价幅度</th>
                    <th>保留价</th>
                    <th>结束状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <!--内容容器-->
                <tbody id="con">
                </tbody>
                <tfoot>
                <tr>
                    <td colspan="7">
                        <!--分页容器-->
                        <div id="paged" style="text-align: right"></div>
                    </td>
                </tr>
                </tfoot>
            </table>
        </div>
    </fieldset>
</div>

<!--模板-->
<script type="text/html" id="conTemp">
    {{# layui.each(d.list, function(index, item){ }}
    <tr>
        <td>{{ item.id }}</td>
        <td>{{ item.title }}</td>
        <td><img src="__PUBLIC__/{{ item.thumb }}" style="width: 60px;height: 60px;"></td>
        <td>{{ getdate(item.starttime)}}</td>
        <td>￥{{ item.startprice }}</td>
        <td>￥{{ item.marupprice }}</td>
        <td>￥{{ item.endprice }}</td>
        <td>
            {{# if(item.isend==1){ }}
                已结束
            {{# }else{  }}
                进行中
            {{# } }}
        </td>
        <td>
            <a href="{:url('Qualify/qualify')}?goodsid={{item.id}}" class="layui-btn layui-btn-mini">进入审核</a>
        </td>
    </tr>
    {{# }); }}
</script>
{include file="common/mainFoot"/}
<script>
    layui.config({
        base: '__ADMIN__/js/'
    }).use(['paging', 'code','icheck','layer'], function() {
        layui.code();
        var paging = layui.paging(),layer = parent.layer === undefined ? layui.layer : parent.layer;

        paging.init({
            url: "{:url('index')}", //地址
            elem: '#con', //内容容器
            params: {}, //发送到服务端的参数
            tempElem: '#conTemp', //模块容器
            pageConfig: { //分页参数配置
                elem: '#paged', //分页容器
                pageSize: 15 //分页大小
            },
            success: function() { //渲染成功的回调
                //alert('渲染成功');
            },
            fail: function(msg) { //获取数据失败的回调
                //alert('获取数据失败')
            },
            complate: function() { //完成的回调
                //alert('处理完成');
            }
        });
        //搜索
        $('#search').on('click', function() {
            var $this = $(this);
            var key = $('#key').val();
            if($.trim(key)=='') {
                layer.msg('{:lang('pleaseEnter')}关键字！');
                return;
            }
            //调用get方法获取数据
            paging.get({
                key: key //获取输入的关键字。
            });
        });

    });

    function getdate(date){
        var date = new Date(date*1000);//如果date为10位不需要乘1000
        var Y = date.getFullYear() + '-';
        var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
        var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
        var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
        var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());
        return Y+M+D+h+m+s;
    }

</script>
